<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8">
	<title>コントロールパネル</title>
    
    <link href="./assets/styles/default.css" rel="stylesheet" />
	<script src="./assets/scripts/libs/jquery-1.7.1.min.js" type="text/javascript"></script>
	<script src="./assets/scripts/import.js" type="text/javascript"></script>
		<script type="text/javascript">
		$(function() {
			$('.message').fadeIn("slow");
			$('.text_date').datepicker({
				changeMonth: true,
				changeYear: true,
				dateFormat: 'yy/mm/dd'
			});
			$('#btn-export').click(function(){	
				if(confirm('ダウンロードしますか？')){
					document.form1.csv.value="download";
					document.form1.submit();
					
				}
			});
			$('#btn-reset').click(function(){	
				location.href = document.form1.action;
			});
			
			$('#btn_search').click(function(){	
				document.form1.csv.value="";
				document.form1.submit();
			});
		});
	
		function toPage(thepage) {
			document.form1.page.value =  thepage;
			document.form1.csv.value="";
			document.form1.submit();
		}

      
		</script>
</head>
<body>
{{$zhead}}
<div id="container">
{{$zmenu}}
    
    <article>
    	<h2><span>&nbsp;</span>会員管理<p><a href="javascript:;">Open Plugins</a></p></h2>
        <nav>
        	<ul>
		<li class="active"><a href="{{'Home/User/index'|U}}"><span>会員検索</span></a></li>
		<li><a href="{{'Home/User/regist'|U}}"><span>会員登録</span></a></li>
		</ul>
        </nav>
        
        <section id="content">
        
        	<h3>会員検索検</h3>
			
			<div id="search_form">
				<form name="form1" id="form1" method="get" action="{{'Home/User/index'|U}}">
					<input type="hidden" name="page" />
					<dl>
						<dt>フリーワード</dt>
						<dd>
							<input type="text" name="free_word" value="{{$forms.free_word}}" />
						</dd>
					</dl>	
					<dl>
						<dt>都道府県</dt>
						<dd>
						<select name="local_cd">
	                       {{html_options options=$dao_local selected=$forms.local_cd}}
                        </select>

						</dd>
					</dl>
					<dl>
						<dt>状態</dt>
						<dd>
							<label><input type="checkbox" name="state[]" {{if $state1==2}}checked="true"{{/if}}value="2" />仮登録</label>
							<label><input type="checkbox" name="state[]" {{if $state2==1}}checked="true"{{/if}}value="1" />公開</label>
							<label><input type="checkbox" name="state[]" {{if $state3==3}}checked="true"{{/if}}value="3" />非公開</label>
						</dd>
					</dl>
					<dl>
						<dt>公開期間</dt>
						<dd>
							<input type="text" name="data1" class="text_date" value="{{ $forms.data1 }}" /> ～ 
							<input type="text" name="data2" class="text_date" value="{{ $forms.data2 }}" />
						</dd>
					</dl>
					<dl>
						<dt>メルマガ</dt>
						<dd>
							<label><input type="checkbox" name="send[]" {{if $send1==1}}checked="true"{{/if}}  value="1" />購読する</label>
							<label><input type="checkbox" name="send[]" {{if $send2==2}}checked="false"{{/if}}  value="2" />購読しない</label>
						</dd>
					</dl>
					<p class="search_submit">
						<button type="button" class="submit" id="btn_search"><span>検索</span></button>
				<input type="hidden" name="search" value="1" />
				<input type="hidden" name="csv" />
					</p>
				</form>
			</div>
			<p class="message">{{ $page.cnt }}件登録されています。</p>
			<p class="btn_dl float-right">
				<a href="javascript:;" id="btn-export">
					CSVダウンロード
				</a>
			</p>

			<table id="search_result" class="sortable">
				<thead>
					<tr>
						<th>状態</th>
						<th>ID</th>
						<th>会員氏名</th>
						<th>貴医院名・<br />貴技工所名</th>
						<th>都道府県</th>
						<th>電話番号</th>
						<th>E-Mail</th>
						<th>参照</th>
						<th>更新</th>
					</tr>
		
				</thead>
				<tbody>
				{{ foreach from=$data key=k item=v name="member" }}
					<tr>
						<td>{{if $v.state=='1' }}通常{{elseif $v.state=='2' }}仮登録 {{else}}退会 {{/if}}</td>
						<td>{{$v.id}}</td>
						<td>{{$v.user_name1}}&nbsp;{{$v.user_name2}}</td>
						<td>{{$v.workshop_name}}</td>
						<td>{{$v.local_name}}</td>
						<td>{{$v.tel_number}}</td>
						<td><a href="mailto:{{$v.email}}">{{$v.email}}</a></td>
						<td class="update"><a href="{{'Home/User/userRefer'|U}}?id={{$v.id}}">参照</a><!--<a href="user_refer.php?id={{$v.id}}">参照</a>--></td>
						<td class="update"><a href="{{'Home/User/userForm'|U}}?id={{$v.id}}">更新</a><!--<a href="user_form.php?id={{$v.id}}">更新</a>--></td>
					</tr>
				{{ /foreach }}	
				</tbody>
			</table>

			<p class="pageNav">
			  {{$pageing}}	
			</p>
						
        </section>
    </article>
    
</div>

{{$zfooter}}
</body>
</html>